<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
       http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

	<context:component-scan base-package="it.ap.sa" />

	<context:property-placeholder location="classpath:config.properties, classpath:acquarium.properties" /> 

	<!-- Configures the @Controller programming model -->
	<mvc:annotation-driven /> 

	<import resource="spring-datasource.xml" />
	<import resource="spring-hibernate.xml" />


<!-- ****************************************** PROXY ******************************************* -->

	<!-- inizializza la connessione proxy se attiva -->
	<bean id="proxy" class="it.ap.sa.core.utils.ProxyUtil" init-method="initSystemProxyConnection" />

<!-- ****************************************** VIEW RESOLVER *********************************** -->

	<!-- Configure the multipart resolver (serve a fare l'upload dei file lato server -->
	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="maxUploadSize" value="999999999" />
		<property name="maxInMemorySize" value="999999999" />
	</bean>
    
    <!-- View Resolver for JSPs -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    	<property name="order" value="1"/>
    	<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/pages/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

 	<bean id="webMessageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
		<property name="basename" value="/bundle/Messages"/>
		<property name="defaultEncoding" value="UTF-8" />
	</bean>
 
<!-- ******************************************************************************************** -->

    <mvc:resources mapping="/css/**" location="/css/"/>
    <mvc:resources mapping="/img/**" location="/img/"/>
    <mvc:resources mapping="/images/**" location="/images/"/>
    <mvc:resources mapping="/js/**" location="/js/"/>
    <mvc:resources mapping="/bundle/**" location="/bundle/"/>
    <mvc:resources mapping="/plugin/**" location="/plugin/"/>
    <mvc:resources mapping="/page/**" location="/page/"/>
    <mvc:resources mapping="/fis/**" location="/WEB-INF/pages/fis/"/>
    <mvc:resources mapping="/acq/**" location="/WEB-INF/pages/acq/"/>
    <mvc:resources mapping="/pla/**" location="/WEB-INF/pages/pla/"/>
    <mvc:resources mapping="/core/**" location="/WEB-INF/pages/core/"/>
    
    
<!-- ******************************************************************************************** -->
    
    <mvc:interceptors>
		<mvc:interceptor>
			<mvc:mapping path="/**" />
			<!-- url pagini -->
			<mvc:exclude-mapping path="/login" />
			<mvc:exclude-mapping path="/logout" />
			<mvc:exclude-mapping path="/accessoNegato" />
			<mvc:exclude-mapping path="/page404" />
			<mvc:exclude-mapping path="/concurrentSessionExpired" />
			<mvc:exclude-mapping path="/policyLogout" />
			<mvc:exclude-mapping path="/chPassword" />
			<mvc:exclude-mapping path="/users/chPassword.pjson" />
			<mvc:exclude-mapping path="/keepAlive" />
			<!-- resources -->
			<mvc:exclude-mapping path="/css/**" />
			<mvc:exclude-mapping path="/img/**" />
			<mvc:exclude-mapping path="/images/**" />
			<mvc:exclude-mapping path="/js/**" />
			<mvc:exclude-mapping path="/bundle/**" />
			<mvc:exclude-mapping path="/plugin/**" />
			<mvc:exclude-mapping path="/page/**" />
			<mvc:exclude-mapping path="/pages/**" />
			
			<bean class="it.ap.sa.acqua.auth.policy.interceptor.RequestTrackingInterceptor" />
		</mvc:interceptor>
	</mvc:interceptors>    
	
<!-- ****************************************TASK SCHEDULER************************************** -->
	
	<!-- configure task schedular  -->
    <task:scheduler id="taskScheduler" pool-size="20"/>

    <!-- NOTA:
      rejection-policy:

      Il tipo di RejectedExecutionHandler. Quando una coda limitata
      non può accettare gli ulteriori compiti, questo determina il comportamento.
      Mentre il valore predefinito è ABORT, considerare l'utilizzo di CALLER_RUNS
      strozzare compiti in entrata. In altre parole, forzando il chiamante
      eseguire il compito stesso, non sarà in grado di fornire un altro compito fino
      dopo aver completato il compito a portata di mano. Nel frattempo, una o
      più compiti possono essere rimosse dalla coda. In alternativa, se è
      non critico per eseguire ogni compito, considerare l'utilizzo di DISCARD per abbandonare
      l'attività corrente o DISCARD_OLDEST per abbandonare l'incarico alla
      testa della coda.
     -->
    <task:executor id="taskExecutor" rejection-policy="DISCARD" />
    <task:annotation-driven executor="taskExecutor" scheduler="taskScheduler" />
</beans>